import Vue from 'vue'
import VueRouter from 'vue-router'

// 后台一级路由
import Home from '../views/home'
// 后台二级路由
import Main from '../views/home/secondrouter/main.vue'

Vue.use(VueRouter)

const routes = [{
  path: '/',
  redirect: '/home'
},
{
  // 后台首页
  path: '/home',
  component: Home,
  // 中间内容模块
  children: [
    {
      // 首页内容
      path: '',
      component: Main
    },
    {
      // 发布文章
      path: '/content/publish',
      component: () => import('../views/home/secondrouter/Publish.vue')
    },
    {
      // 文章列表
      path: '/content/articles',
      component: () => import('../views/home/secondrouter/Articles.vue')
    },
    {
      // 评论管理
      path: '/content/comment',
      component: () => import('../views/home/secondrouter/Comment.vue')
    },
    {
      // 素材管理
      path: '/content/material',
      component: () => import('../views/home/secondrouter/Material.vue')
    }
  ]
},
{
  // 登陆组件
  path: '/login',
  component: () => import('../views/login')
}

]

const router = new VueRouter({
  routes
})

export default router
